package activity;

import activity.domain.Activity;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 罗俊华
 * @date 2021/5/26 - 8:35 上午
 */
public class ActivitySelect {

    public static List<Activity> select(int[] startTime, int[] finishTime) {

        List<Activity> list = new ArrayList<Activity>();

        list.add(new Activity(startTime[0], finishTime[0]));

        int m = 0;

        for (int i = 1; i < finishTime.length; i++) {
            if (startTime[i] >= finishTime[m]) {
                m = i;
                list.add(new Activity(startTime[m], finishTime[m]));
            }
        }


        return list;

    }
}
